var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({__proto__: []} instanceof Array && function (d, b) {
            d.__proto__ = b;
        }) ||
        function (d, b) {
            for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
        };
    return function (d, b) {
        extendStatics(d, b);

        function __() {
            this.constructor = d;
        }

        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var _a;
var Student = /** @class */ (function () {
    function Student(firstName, middleInitial, lastName) {
        this.firstName = firstName;
        this.middleInitial = middleInitial;
        this.lastName = lastName;
        this.fullName = firstName + " " + middleInitial + " " + lastName;
    }

    return Student;
}());

function greeter(person) {
    return "Hello, " + person.firstName + " " + person.lastName;
}

var user = new Student("Jane", "M.", "User");
// document.body.innerHTML = greeter(user);
var isDone = false;
var lala = 0X66;
var name1 = "sss:";
var name2 = "lalalalal";
name2 = "1234567890";
console.log(name1 + "    ----     " + name2);
var age = 12;
var name3 = " Hello Java , this.name = " + name2 + " " + name2;
console.log(name3);
var sentence = "Hello, my name is " + name1 + ". I'll be " + (age + 1) + " years old next month.";
console.log(sentence);
var list = [1, 2, 3];
var list2 = [1, 2, 3, 4];
list2.push(5);
var la = list2.indexOf(0, 3);
console.log(list);
console.log(list2);
console.log(la);
var list3 = [1.2, 2.3, 4, 5, 6];
console.log(list3);
var x = ["songxiankun", 100];
console.log(x);
console.log(x[0].substr(3));
x[3] = "2008@126.com";
x[4] = 999;
console.log(x.toString() + "     ?");
console.log(x.toString());
// let c: Color = Color.Green;
// console.log(c);
//
// let sad: String = Color[1];
// console.log(sad);
var lalala = 88;

function f() {
    var a = 10;
    return function g() {
        var b = a + 1;
        return b;
    };
}

var g = f();
g();
try {
}
catch (e) {
    console.log(e);
}
finally {
}

function ff(number, String) {
    var qw = 123;
    return qw;
}

console.log(ff);

function f2(condition, x) {
    if (condition) {
        var x_1 = 100;
        return x_1;
    }
    return x;
}

f2(false, 0); // returns 0
f2(true, 0); // returns 100
function sumMatrix(matrix) {
    console.log(matrix.toString() + "     ...." + matrix.length);
    var sum = 0;
    for (var i = 0; i < matrix.length; i++) {
        var currentRow = matrix[i];
        for (var i_1 = 0; i_1 < currentRow.length; i_1++) {
            sum += currentRow[i_1];
        }
    }
    return sum;
}

var po = [[123], [456]];
console.log(sumMatrix(po) + "          po");
var input = [1, 2, 99];
var first = input[0], second = input[1], sha = input[2];
console.log(first); // outputs 1
console.log(second); // outputs 2
console.log(sha);
_a = [first, sha, second], sha = _a[0], first = _a[1], second = _a[2];
/**** swap variables ***/
console.log("first=" + first + ",sha=" + sha + ",second=" + second);

/**** 这个厉害了 ***/
function f3(_a) {
    var first = _a[0], second = _a[1];
    console.log(first);
    console.log(second);
}

function f4(_a, String) {
    var a = _a[0], b = _a[1], c = _a[2], d = _a[3], e = _a[4];
}

var _b = [1, 2, 3, 4, 5], ggg = _b[0], ppp = _b.slice(1);
console.log(ggg + "    =>单个数字");
console.log(ppp + "  =>这是一个简单的集合");

function keepWholeObject(wholeObject) {
    var a = wholeObject.a, _a = wholeObject.b, b = _a === void 0 ? 1001 : _a;
}

var first1 = [1, 2];
var second1 = [3, 4];
var bothPlus = [0].concat(first1, second1, [5]);
console.log(bothPlus);

/**** 完全没懂是啥意思 ***/
function printLabel(labelledObj) {
    console.log(labelledObj.label);
}

var myObj = {size: 10, label: "Size 10 Object"};
printLabel(myObj);
var xixi = 123;
xixi = "La La La";
console.log("这是xixi:" + xixi);

function f1() {
    /**** 这是一个没有返回值的方法 ***/
    console.log("这是一个没有返回值的方法");
}

function f5(name) {
    return "";
}

var person = /** @class */ (function () {
    function person() {
    }

    return person;
}());
var person1 = new person();
person1.age = 18;
person1.name = "lisi";
console.log("person =>> " + person1.name + "  |   " + person1.age);

function f6(a, b, c) {
    if (c === void 0) {
        c = "这是一个默认值";
    }
}

f6("aaa", "bbb", "ccc");
/**** 有默认值的就可以不用传 ？ ***/
f6("ddd", "eee");

function f7(a, b, c) {
    if (c === void 0) {
        c = "why ";
    }
    console.log(b.length);
    console.log("如果  b    没有参数可以传入的话,那么此处就会报错");
}

/**** 按照顺序传入参数,带问号表示是可选参数传入,第三个参数就必须要强制设置成默认值 ？！  ***/
f7("aaa", "bbb", "cccwhy ???");

// f7("ssssss");
/**** 此处没有传入第二个参数,Error : Exception ***/
function f8() {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
    }
    args.forEach(function (arg) {
        console.log(arg);
    });
}

function f9() {
    var 啦 = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        啦[_i] = arguments[_i];
    }
    啦.forEach(function (拉) {
        console.log(拉);
    });
    for (var i = 0; i < 啦.length; i++) {
        console.log(啦[i]);
    }
}

var arrrr = [99, 88, 77, 66.55, 123.54, 999999999999, 88.123456789];
f9(arrrr);
/****     yield() 和  next()   这两个方法怎么没有  ???  ***/
var ll = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
var b = ll[2], a = ll[3];
console.log(a);
console.log(b);
var c = ll[0], d = ll[1], others = ll.slice(2);
console.log(c);
console.log(d);
console.log(others);
/**** ---------------------------------------------- ***/
var personOne = /** @class */ (function () {
    function personOne() {
        this.name = null;
        console.log(" this is 构造器！？");
        this.name = name;
    }

    personOne.prototype.eat = function () {
        console.log("what?");
    };
    personOne.prototype.lalala = function () {
        var personOne1 = new personOne();
        personOne1.eat();
        personOne1.lalala();
        while (false) {
            return;
        }
    };
    return personOne;
}());
var one = new personOne();
one.name = "zhangsan";
one.eat();
var two = new personOne();
two.name = "lisi";
two.eat();
var Me = /** @class */ (function (_super) {
    __extends(Me, _super);

    function Me(name, Id) {
        return _super.call(this) || this;
    }

    Me.prototype.lalala = function () {
        console.log("继承方法!");
        ;
    };
    return Me;
}(personOne));
new Me("songxiankun2008@126.com", 18);
var mySearch;
mySearch = function (source, subString) {
    var result = source.search(subString);
    return result > -1;
};

function createClock(ctor, hour, minute) {
    return new ctor(hour, minute);
}

var DigitalClock = /** @class */ (function () {
    function DigitalClock(h, m) {
    }

    DigitalClock.prototype.tick = function () {
        console.log("beep beep");
    };
    return DigitalClock;
}());
var AnalogClock = /** @class */ (function () {
    function AnalogClock(h, m) {
    }

    AnalogClock.prototype.tick = function () {
        console.log("tick tock");
    };
    return AnalogClock;
}());
var digital = createClock(DigitalClock, 12, 17);
var analog = createClock(AnalogClock, 7, 32);
